package com.google.rpc;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class RpcProxyServer {
    ExecutorService executorService=Executors.newCachedThreadPool();
    public void publisher(Object service,int port){
        ServerSocket serverSocket=null;
        try {
            //启动一个服务
            serverSocket=new ServerSocket(port);
            while (true){
                Socket socket=serverSocket.accept();
                executorService.execute(new ProcessorHandler(service,socket));
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
